/** 
 * File-Name:WebpageParserTest.java
 *
 * Created on 2011-10-24 下午04:05:33
 * 
 * @author: Neo (neolimeng@gmail.com)
 * Software Engineering Institute, Peking University, China
 * 
 * Copyright (c) 2009, Peking University
 * 
 *
 */
package org.wsal.parser.webpage;

import static org.junit.Assert.fail;

import java.io.File;

import org.apache.commons.io.FileUtils;
import org.junit.Test;

/**
 * Description:
 * 
 * @author: Neo (neolimeng@gmail.com) Software Engineering Institute, Peking
 *          University, China
 * @version 1.0 2011-10-24 下午04:05:33
 */
public class WebpageParserTest {

	/**
	 * Test method for {@link org.wsal.parser.webpage.WebpageParser#getText()}.
	 */
	@Test
	public void testGetText() {
		WebpageParser webpageParser = new WebpageParser();

		String webpage = null;
		try {

			webpage = FileUtils
					.readFileToString(new File(
							"E:\\LabEclipse\\WSAL-Parser\\WebContent\\samples\\Sample01.html"));
			String text = webpageParser.getText(".title", webpage);
			System.out.println(text);
			if (text == null || !text.equals("Introduction to WSAL")) {
				fail("The extraced text is not the same as 'Introduction to WSAL'");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
